// pages1/integral/integral.js
const app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    icon:["http://oss.diywoju.com/web/uploads/image/store_1/f32d6031a1f478b1cbbe28ca9c00a4f51edab1e3.png",'http://oss.diywoju.com/web/uploads/image/store_1/87c1cf144ad0ca42e30bc0d23c6408de6abe0751.png','http://oss.diywoju.com/web/uploads/image/store_1/8fe3e05f7ee325f0af7ba3ab18b1de6d86d7dab2.png'],
    list:[],//兑换商品列表
    lunbo:["https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1583145950895&di=755f133f6ccebc3d817bc795fb2a2078&imgtype=0&src=http%3A%2F%2Fimg.zcool.cn%2Fcommunity%2F012a3656ee32ba32f875a9445125ce.jpg","https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1583146049931&di=f309a8654d96b5550860ddb406836a44&imgtype=0&src=http%3A%2F%2Fimg.zcool.cn%2Fcommunity%2F016c0158a6616aa801219c77a57442.jpg","https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1583146167962&di=9b15a2f98e19949ee4b6c4a59f248511&imgtype=0&src=http%3A%2F%2Fwww.amaomb.com%2Fuploads%2Fallimg%2F140423%2F1-140423205030220.jpg"],
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.index();
  },
  gotodetail(e){
    wx.navigateTo({
      url: '/pages1/shop_detail/shop_detail?id='+e.currentTarget.dataset.id,
    })
  },
  index(){
    let that = this;
    app.request({
      url:app.api.integral.index,
      method:"GET",
      success(res){
        let list = [];
        res.data.goods_list.forEach((item,index) => {
          item.goods.forEach((item2,index2) =>{
            list.push(item2)
          })
        });
        that.setData({
          list
        })
      }
    })
  }
})